package org.nepu.scr.indexrate.converter.longevityrate;

import cn.hutool.json.JSONUtil;
import org.nepu.scr.indexrate.vo.longevityrate.BaseC22;

import javax.persistence.AttributeConverter;
import javax.persistence.Convert;

@Convert
public class BaseC22Converter implements AttributeConverter<BaseC22, String> {
    @Override
    public String convertToDatabaseColumn(BaseC22 baseC22) {
        return JSONUtil.toJsonStr(baseC22);
    }

    @Override
    public BaseC22 convertToEntityAttribute(String s) {
        return JSONUtil.toBean(s, BaseC22.class);
    }
}
